import request from '@/utils/request.js'

// 封装注册接口
export const userRegisterService = (registerDate) => {
    // 通过URLSearchParams将形参转化类型后给接口输入
    const parms = new URLSearchParams();
    for (let n in registerDate) {
        parms.append(n, registerDate[n]);
    }
    return request.post('/user/register', parms);
}

// 封装登录接口
export const userLoginService = (loginDate) => {
    return request.post('/user/login', loginDate);
}

// 封装用户信息接口
export const userInfoService = () => {
    return request.get('/user/userInfo');
}
// 封装用户信息接口
export const userKey = () => {
    return request.get('/user/key');
}


// 封装用户信息更改接口
export const userInfoUpdateService = (userInfoData) => {
    return request.post('/user/update', userInfoData);
}

// 封装用户头像更新接口
export const userAvatarUpdateService = (userPic) => {
    return request.post('/user/updateAvatar?userPic=' + userPic);
}

// 封装用户密码修改接口
export const userPasswordUpdateService = (updatePwData) => {
    return request.post('/user/updatePwd', updatePwData);
}